package com.e.servlet;

import java.io.IOException;
import java.io.PrintWriter;

import javax.servlet.ServletConfig;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * Servlet implementation class SuServlet
 */
public class SuServlet extends HttpServlet {
	private static final long serialVersionUID = 1L;
       
    /**
     * @see HttpServlet#HttpServlet()
     */
    public SuServlet() {
        super();
        // TODO Auto-generated constructor stub
    }

	/**
	 * @see Servlet#init(ServletConfig)
	 */
	public void init(ServletConfig config) throws ServletException {
		// TODO Auto-generated method stub
	}

	/**
	 * @see Servlet#destroy()
	 */
	public void destroy() {
		// TODO Auto-generated method stub
	}

	/**
	 * @see HttpServlet#service(HttpServletRequest request, HttpServletResponse response)
	 */

	/**
	 * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		// TODO Auto-generated method stub
		//response.getWriter().append("Served at: ").append(request.getContextPath());
	}

	/**
	 * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		// TODO Auto-generated method stub
		//doGet(request, response);
		String sid=request.getParameter("sid");
		String sname=request.getParameter("sname");
		String birth=request.getParameter("birth");
		String sex=request.getParameter("sex");
		String zhiye=request.getParameter("zhiye");
		String zhusuo=request.getParameter("zhusuo");
		String phone=request.getParameter("phone");
		response.setCharacterEncoding("UTF-8");//设置输出内容的编码格式
		response.setContentType("text/html");//设置输出的文件类型
		PrintWriter out = response.getWriter();//响应页面
		out.println("编号："+sid+"<br/>");
		out.println("姓名："+sname+"<br/>");
		out.println("生日："+birth+"<br/>");
		out.println("性别："+sex+"<br/>");
		out.println("职业："+zhiye+"<br/>");
		out.println("住所："+zhusuo+"<br/>");
		out.println("电话："+phone+"<br/>");
		out.flush();
		out.close();// 关闭输出流
	}

}
